package com.example.test13.Controller;

import com.example.test13.Service.LoginService;
import com.example.test13.emity.JsonData;
import com.example.test13.emity.User;
import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping(value="/rent/user")
public class LoginController {
    @Resource
    LoginService loginService;
    //登录
    @PostMapping(value="login")
    public JsonData login(@RequestBody User user){
        User result=loginService.login(user);
        if (result != null){
            return new JsonData(0,result,"登录成功");
        }else{
            return new JsonData(-1,"用户不存在");
        }
    }

}
